package com.lagou.rpc.consumer.controller;

import com.alibaba.fastjson.JSON;
import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.annotation.Remote;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Remote
    private IUserService userService;

    @GetMapping(value = "/user/{id}")
    public String queryUser(@PathVariable Integer id ){
        System.out.println("request user id ="+id);

        return JSON.toJSONString(userService.getById(id));
    }
}
